package com.member.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizGradeLog;
import com.member.shop.mapper.SysBizGradeLogMapper;
import com.member.shop.service.ISysBizGradeLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * 等级变动记录Service业务层处理
 *
 * @author wangxin
 * @date 2024-06-13
 */
@Service
public class SysBizGradeLogServiceImpl extends ServiceImpl<SysBizGradeLogMapper, SysBizGradeLog> implements ISysBizGradeLogService {
    @Resource
    private SysBizGradeLogMapper sysBizGradeLogMapper;

    /**
     * 查询等级变动记录
     *
     * @param id 等级变动记录主键
     * @return 等级变动记录
     */
    @Override
    public SysBizGradeLog selectSysBizGradeLogById(Long id) {
        return sysBizGradeLogMapper.selectById(id);
    }

    /**
     * 查询等级变动记录列表
     *
     * @param queryWrapper 等级变动记录
     * @return 等级变动记录
     */
    @Override
    public List<SysBizGradeLog> selectSysBizGradeLogList(LambdaQueryWrapper<SysBizGradeLog> queryWrapper) {
        return sysBizGradeLogMapper.selectList(queryWrapper);
    }

    @Override
    public List<SysBizGradeLog> selectSysBizGradeLogList(SysBizGradeLog sysBizGradeLog) {
        return sysBizGradeLogMapper.selectSysBizGradeLogList(sysBizGradeLog);
    }

    /**
     * 新增等级变动记录
     *
     * @param sysBizGradeLog 等级变动记录
     * @return 结果
     */
    @Override
    public int insertSysBizGradeLog(SysBizGradeLog sysBizGradeLog) {
        sysBizGradeLog.setCreateTime(DateUtils.getNowDate());
        return sysBizGradeLogMapper.insert(sysBizGradeLog);
    }

    /**
     * 修改等级变动记录
     *
     * @param sysBizGradeLog 等级变动记录
     * @return 结果
     */
    @Override
    public int updateSysBizGradeLog(SysBizGradeLog sysBizGradeLog) {
        sysBizGradeLog.setUpdateTime(DateUtils.getNowDate());
        return sysBizGradeLogMapper.updateById(sysBizGradeLog);
    }

    /**
     * 批量删除等级变动记录
     *
     * @param ids 需要删除的等级变动记录主键
     * @return 结果
     */
    @Override
    public int deleteSysBizGradeLogByIds(Long[] ids) {
        return sysBizGradeLogMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除等级变动记录信息
     *
     * @param id 等级变动记录主键
     * @return 结果
     */
    @Override
    public int deleteSysBizGradeLogById(Long id) {
        return sysBizGradeLogMapper.deleteById(id);
    }

    @Override
    public List<SysBizGradeLog> selectSysBizGradeLog(SysBizGradeLog sysBizGradeLog) {
        return sysBizGradeLogMapper.selectSysBizGradeLog(sysBizGradeLog);
    }
}
